package vsvm.graphics.charts;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import ptolemy.plot.Plot;


public abstract class AbstractChart extends Plot{

	String title = null;
	boolean chartPrepared = false;
	
	public AbstractChart(String title)
	{
		this.title = title;
		this.setBackground(Color.WHITE);
	}

	protected abstract Graphics2D drawChart(Graphics2D g);
	protected abstract void prepareColors();
	
	protected void prepareChart() {};	
	
	public void paint(Graphics g)
	{
		prepareColors();
		if (!chartPrepared) prepareChart();		
		super.paint(g);		
		g = drawChart((Graphics2D) g);		
	}
	
	public String getTitle()
	{
		return title;
	}
}
